<form action="<{link app=b2c ctl='site_passport' act='create' args01=$next_url}>" method="post" id="signup">
    <input name="forward" type="hidden" value="<{$options.url}>">
    <input name="mini" type="hidden" value="<{$mini_passport}>">
    <ul>


        <li class="form-group" id="reg_email">
            <label for=""><em class="warn">*</em><{t}>注册账号：<{/t}></label>
            <span class="form-act"><{input id="e" type="text" onblur="var regex = /^([a-z0-9_\.-])+@[a-z0-9-]+\.([a-z]{2,4}\.)?[a-z]{2,4}$/i;if(regex.test(this.value)) { try {rrApi.setEmail(this.value);}catch(e){}}" signup_type="email" name="pam_account[login_name]" class="action-account-check form-control" placeholder=$___b2c="ivanov@mail.ru"|t:'b2c' vtype="required&&email" data-caution=$___b2c="请填写登录帐号，最少4个字符"|t:'b2c' autofocus}><span class="validation-messagebox"></span></span>
			<span class="hide">teeeest</span>
        </li>

        <li class="form-group">
            <label for=""><em class="warn">*</em><{t}>地区：<{/t}></label>
            <span class="form-act del_margin"><{input type="region" name="area" required="true"  app="ectools" callback="selectArea" class="form-control"}></span>
        </li>
        <li class="form-group">
            <div class="ad_ina">
                <label for=""><em class="warn">*</em><{t}>付款人类型：<{/t}></label>
                <div class="radio">
                    <label>
                        <input onclick="change_text1()" class="c-type" name="c_type" value="0" checked="" type="radio">Юридическое лицо</label>
                </div>
                <div class="radio">
                    <label>
                        <input onclick="change_text2()" class="c-type" name="c_type" value="2" type="radio">Индивидуальный предприниматель</label>
                </div>
                <div class="radio">
                    <label>
                        <input onclick="change_text3()" class="c-type" name="c_type" value="3" type="radio">Физическое лицо</label>
                </div>
            </div>
            <div class="chose_val">
                <div class="ad_ina form-group" id="change_input">
                    <label><em class="warn">*</em>Наименование</label>
                    <input id="com_name" placeholder="Наименование" class="ad_in1 form-control" name="company_name" value="" type="text" vtype="required">
                </div>
                <div class="ad_ina form-group ifno">
                    <label><em class="warn">*</em><{t}>税务登记号<{/t}>:</label>
                    <input id="com_taxno" placeholder="<{t}>税务登记号<{/t}>" class="ad_in1 form-control" name="company_taxno" value="" type="text"  vtype="required&&minLength:10&&maxLength:10&&number">
                </div>
            </div>

        </li>
        <li class="form-group">
            <label for=""><em class="warn">*</em><{t}>姓名：<{/t}></label>
            <span class="form-act"><{input type="text" name="name" id=""  placeholder=$___b2c="ООО«Обувь»"|t:'b2c' vtype="required" class="form-control"}></span>
        </li>
        <li class="form-group">
            <label for=""><em class="warn">*</em><{t}>密码：<{/t}></label><span class="form-act"><{input type="password" name="pam_account[login_password]" maxlength="20" placeholder=$___b2c="6-20个字符"|t:'b2c' vtype="required&&minLength:6&&maxLength:20" data-caution=$___b2c="请填写密码，6-20个字符&&输入不正确，最少6个字符&&输入不正确，最多20个字符"|t:'b2c' check='true' class="form-control"}></span>
        </li>
        <li class="form-group">
            <label for=""><em class="warn">*</em><{t}>确认密码：<{/t}></label><span class="form-act"><{input type="password" name="pam_account[psw_confirm]" id="" class="x-input form-control" maxlength="20" placeholder=$___b2c="再次填写密码"|t:'b2c' vtype="equal:pam_account[login_password]" data-caution=$___b2c="密码与确认密码不相符，请重新填写"|t:'b2c'}><span class="validation-messagebox"></span></span>
        </li>
        <{foreach from=$attr item=item name="item" key='row'}>
        <li class="form-group">
            <label for="" ><{if $item.attr_required eq 'true'}><em class="warn">*</em><{/if}><{$item.attr_name}>：</label>
    <span class="form-act">
      <{if $item.attr_type =='date'}>
        <{if $item.attr_value != '0-0-0'}>
          <{assign var=value value=$item.attr_value}>
        <{/if}>
        <{if $item.attr_required eq 'true'}>
          <{assign var=vtype value="required"}>
        <{/if}>
        <!-- datepicker滚动定位问题 -->
        <{if $mini_passport == true}>
          <{assign var=options value="{inject:'mini_signup'}"}>
        <{/if}>
        <{input type="datepicker" data-calendar-options=$options vtype=$vtype name=$item.attr_column value=$value}>
      <{/if}>

      <{if $item.attr_type =='region'}>
      <{if $item.attr_required eq 'true'}>
      <{input app=ectools type="region" name=$item.attr_column value=$item.attr_value vtype="area"}>
      <{else}>
      <{input app=ectools type="region" name=$item.attr_column value=$item.attr_value}>
      <{/if}>
      <{/if}>

      <{if $item.attr_type =='gender'}>
      <{input type='gender' name=$item.attr_column value=$item.attr_value}>
      <{/if}>

      <{if $item.attr_type =='select'}>
      <select name="<{$item.attr_column}>" class="x-select form-control" <{if $item.attr_required eq 'true'}>vtype="required"<{/if}>>
        <option value="" <{if $item.attr_value == ''}>selected="selected"<{/if}>><{t}>请选择<{/t}></option>
        <{foreach from=$item.attr_option item=option name="option"}>
        <option value="<{$option}>" <{if $item.attr_value == $option}>selected="selected"<{/if}>><{$option}></option>
        <{/foreach}>
        </select>
        <{/if}>

      <{if $item.attr_type =='checkbox'}>
      <{foreach from=$item.attr_option item=checkbox name="checkbox" }>
     <div class="checkbox">
         <label>
             <input type="checkbox" name="box:<{$item.attr_column}>[]" value="<{$checkbox}>"<{if $item.attr_required eq 'true' && $smarty.foreach.checkbox.iteration==1}> vtype="onerequired"<{/if}> <{foreach from=$item.attr_value item=checkboxvalue name="checkboxvalue" }><{if $checkboxvalue==$checkbox}>checked="checked"<{/if}><{/foreach}>>
             <{$checkbox}>
         </label>
     </div>
      <{/foreach}>
      <input type="hidden" name="<{$item.attr_column}>[]" value="%no%">
      <{/if}>

      <{if $item.attr_type == 'text' || $item.attr_type == 'number' || $item.attr_type == 'alpha'}>
      <input type="text" class="x-input form-control" name="<{$item.attr_column}>" value="<{$item.attr_value}>" vtype="<{if $item.attr_required eq 'true'}>required<{/if}><{if $item.attr_valtype}><{if $item.attr_required eq 'true'}>&&<{/if}><{$item.attr_valtype}><{/if}>" />
      <{/if}>
    </span>
        </li>
        <{/foreach}>

        <li class="form-group">
            <label for=""><em class="warn">*</em><{t}>手机号：<{/t}></label>
            <div class="row">
                <div class="col-lg-6 col-md-4 col-sm-4 col-xs-4">
                    <select name="pam_account[phone_setting]" id="quhao" class="form-control">
                        <{foreach from=$phones item=items}>
                        <option sid="<{$items.length}>" value="<{$items.area}>"><{$items.country}><{$items.area}></option>
                        <{/foreach}>
                    </select>
                </div>
                <div class="col-lg-6 col-md-8 col-sm-8 col-xs-8">
                    <{input type="text" name="pam_account[login_mobile]" signup_type="mobile"  placeholder=$___b2c="9161234567"|t:'b2c' vtype="required" id="check_tel" class="action-account-check form-control"}>
                    <span  style="color:red" class="validation-messagebox" id="phoneid"></span>
                </div>
            </div>
        </li>
       <!-- <li class="form-group action-mobile-verify" >
            <label for=""><{t}>短信验证码：<{/t}></label>
      <span class="form-act">
      <div class="row">
          <div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
              <{input type="text" name="m_vcode" id="" vtype="required" class="verify-input form-control"}>
          </div>
          <div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
              <a href="<{link app=b2c ctl=site_passport act=send_vcode_sms}>" class="btn btn-success btn-block action-get-verifycode"><span><span><{t}>获取短信验证码<{/t}></span></span></a>
          </div>
      </div>
      <div class="clearfix"></div>
      </span>
        </li>-->
        <li class="checkbox">
            <label for="" class="small">
                <input type="checkbox" name="license" id="" class="x-check" vtype="onerequired" data-caution="<{t}>请选择同意<{/t}>" checked="checked">
			  Нажимая на кнопку "Зарегистрироваться", я даю согласие на обработку персональных данных в соответствии с <a href="/soglashenie_konfidentsialnosti" target="_blank">Политикой конфиденциальности</a>, <a href="<{link app=b2c ctl=site_passport act=license }>" target="_blank">Пользовательским соглашением о регистрации</a> и условиями <a href=" <{link app=b2c ctl=site_passport act=privacy }>" target="_blank">Конфиденциальности персональной информации</a>
			  </label>
            <span class="validation-messagebox"></span>

        </li>
        <li class="form-group">
            <{assign var='label' value=$___b2c='注册'|t:'b2c'}>
            <{button id="btn1" type="submit" class="btn btn-primary pull-right login_true" label=$__b2c=$label|t:'b2c' rel="_request"}>
            <div class="clearfix"></div>
        </li>
    </ul>
</form>
<script>
    window.addEvent('domready',function(){

        $("check_tel").addEvent('blur',function(){
            var str = this.get('value').trim();
            var obj = $$("#quhao option:selected");
            var num = obj[0].get('sid');
            var reg = new RegExp("^[1-9]\\d{"+(num-1)+"}$");

//    if(str.length!=0){
//       if(!reg.test(str)){
//          $("phoneid").set('html','<{t}>手机格式错误<{/t}>');
//       }else{
//          $("phoneid").set('html','');
//       }
//    }
        });

        $("quhao").addEvent('change',function(){
            $('check_tel').set('value','');
        });
    });

    $("btn1").addEvent('click', function(e){
        var str = $('check_tel').get('value').trim();
// var num = $('check_tel').getPrevious('select').get('sid');
        var obj = $$("#quhao option:selected");
        var num = obj[0].get('sid');
        var reg = new RegExp("^[1-9]\\d{"+(num-1)+"}$");

        if(str.length!=0){
            if(!reg.test(str)){
                $("phoneid").set('html','<{t}>手机格式错误<{/t}>');
                e.stop();
            }else{
                $("phoneid").set('html','');
            }
        }
    });
    jQuery(".del_margin .x-select").first().css("margin","0");
    var ifhave =  '<div class="ad_ina form-group ifno"><label><{t}>税务登记号<{/t}>:</label><input id="com_taxno" placeholder="<{t}>税务登记号<{/t}>" class="ad_in1 form-control" name="company_taxno" value="" type="text"></div>'
    function change_text1(){
        jQuery('#change_input label').html('<em class="warn">*</em>Наименование');
        jQuery('#com_name').attr('placeholder','Наименование');
        jQuery('#com_taxno').attr('vtype','required&&minLength:10&&maxLength:10&&number');
        if(jQuery('.ifno').length<1){
            jQuery('#change_input').parents('li').append(ifhave);
        }
    }
    function change_text2(){
        jQuery('#change_input label').html('<em class="warn">*</em>ФИО ');
        jQuery('#com_name').attr('placeholder','ФИО ');
        jQuery('#com_taxno').attr('vtype','required&&minLength:12&&maxLength:12&&number');
        if(jQuery('.ifno').length<1){
            jQuery('#change_input').parents('li').append(ifhave);
        }
    }
    function change_text3(){
        jQuery('#change_input label').html('<em class="warn">*</em>ФИО ');
        jQuery('#com_name').attr('placeholder','ФИО ');
        jQuery('.ifno').remove();
    }
</script>

